package demo.socket;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class StringServer {
	public static void main(String[] args) throws IOException {
		@SuppressWarnings("resource")
		ServerSocket serverSocket = new ServerSocket(10000);
		while (true) {
			new Req(serverSocket.accept()).start();
		}
	}
}

class Req extends Thread {
	Socket socket = null;

	Req(Socket socket) {
		this.socket = socket;
	}

	public void run() {
		System.out.println("���ӷ�����");
		try {
			PrintWriter pw = new PrintWriter(socket.getOutputStream(), true);
			BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
			String str = null;
			while ((str = br.readLine()) != null) {
				pw.println(str.toUpperCase());
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
